<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:rich="http://richfaces.org/rich"
	xmlns:a4j="http://richfaces.org/a4j"	
	xmlns:ui="http://java.sun.com/jsf/facelets">
	<ui:composition template="/template.jsp">

	<ui:define name="titulo"> <h:outputLabel value="#{msgs['tela.alterarDocumento']}" /> </ui:define>
		<ui:define name="corpo">
			<rich:panel header="Incluir Documento">
				<h:form id="frm">

				<h:panelGrid columns="3">
					<h:outputLabel value="#{msgs['label.usuario']}" />
					<h:selectOneMenu id="usuario"
						value="#{documentoController.documento.usuario}" required="true"
						requiredMessage="Campo obrigatório">
						<f:selectItem itemValue="" itemLabel="Selecione" />
						<f:selectItems value="#{documentoController.listaUsuarios}" />
					</h:selectOneMenu>
					<rich:message for="usuario" ajaxRendered="true"	errorClass="rf-msg-err" />
				</h:panelGrid>
				<br />
				<h:outputLabel value="#{msgs['label.anexo']}" />
				<h:commandLink action="#{documentoController.download}">
					<f:setPropertyActionListener value="#{documentoController.documento}" target="#{documentoController.documento}" />
					<h:outputText value="#{documentoController.documento.nome}"/>
				</h:commandLink>
				<rich:fileUpload addControlLabel="Adicionar" uploadControlLabel="Alterar documento" clearAllControlLabel="Limpar todos"  clearControlLabel="Limpar" stopControlLabel="Parar" cancelEntryControlLabel="Cancelar"  fileUploadListener="#{documentoController.upload}"></rich:fileUpload>
					 <br/>
					 <h:commandButton value="Voltar" action="#{documentoController.listar}" type="button" immediate="true"/>
				</h:form>
			</rich:panel>
		</ui:define>
	</ui:composition>

</html>
